﻿
using Dapper;
using HBase; 
using System.Data;
using System.Diagnostics;
using System.Linq;
namespace hCommand
{
    /**
   *┌────────────────────────────────────────────────┐
   *│　描    述：Component                                                    
   *│　作    者：sgj                                              
   *│　版    本：1.0                                              
   *│　创建时间：2020/9/2 11:28:16                        
   *└────────────────────────────────────────────────┘
   **/
    public class DesMoveBSEngine<CS> : AbsTaskCSComp where CS : AbsCoreStock  {
        public long stockId;
        public int des;

        virtual protected bool per() {
            return true;
        }
        protected override TransRes Execute( ) {
            if (!per()) {
                return new TransRes("预处理失败");
            } 
            CS cs = getById<CS>(stockId);
 
            if(cs == null ) {
                return new TransRes("stock 为空");
            } 
            if ((int)StockStatus.库存 != cs.status) {
                return new TransRes("stock 状态异常");
            } 
            CoreWhLoc loc = getById<CoreWhLoc>(des); 
            if( loc == null ) {
                return new TransRes("货位获取异常"); 
            }
            if (loc.countStock != 0) {
                return new TransRes("目标货位库存异常");
            }
            createIn2OutTask(cs, des); 
            return new TransRes();
        }

    }
}
